In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
Byteasar owns a garden in which he grows apple-trees bearing golden apples. The work in the garden is quite hard and Byteasar is not as strong and healthy as he used to be in the old days. Therefore he decided to divide his garden into parcels that he would give to his sons. Byteasar would like each of his sons to have a wealthy life, so he would like each of the parcels to contain at least one of the priceless apple-trees.
Byteasar's garden has the shape of an square. For simplicity we introduce a rectangular coordinate system in the garden, in which the lower left corner of the garden has coordinates and the upper right corner has coordinates . Some unit squares contain apple-trees. Each of the parcels should be a rectangle with sides parallel to the axes of the coordinate system and integer coordinates of corners. The sides of the parcels may touch, but the parcels cannot overlap. The parcels should cover the whole garden. Each parcel may have an arbitrary size and must contain at least one apple-tree.
You may assume that the desired division of the garden is possible to accomplish.
The first line of input contains two integers and (, ) that represent the length of the side of the garden and the number of Byteasar's sons. The following lines describe the unit squares of the garden. Each of those lines contains characters x and/or . that represent a unit square with or without an apple-tree, respectively.
Your program should output lines that describe a correct division of the garden into parcels. Each of the lines should contain four integers , , , that give the coordinates of the lower left and the upper right corner of the garden. The order of the parcels in the output does not matter.
For the input data:
6 5 ..x..x ..x... ....x. xx.x.x ...... ......
the correct result is:
0 0 3 4 0 4 5 5 5 4 6 6 3 0 6 4 0 5 5 6
Task author: Jakub Radoszewski.